<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>后台登录界面</title>
        <link href="<?php echo HTTP_UI; ?>css/common.css" rel="stylesheet" type="text/css"/>
        <link href="<?php echo HTTP_UI; ?>css/login.css" rel="stylesheet" type="text/css"/>
        <link href="<?php echo HTTP_EXTENDS; ?>nice_validator/jquery.validator.css" rel="stylesheet" type="text/css"/>
        <script src="<?php echo HTTP_UI; ?>js/jquery-1.11.2.min.js" type="text/javascript"></script>
        <script src="<?php echo HTTP_EXTENDS; ?>nice_validator/jquery.validator.js" type="text/javascript"></script>
        <script src="<?php echo HTTP_EXTENDS; ?>nice_validator/local/zh_CN.js" type="text/javascript"></script>
    </head>
    <body>
        <div class="login_main">
            <div class="login_screen">
                <div class="login_screen_bgc">
                    <div class="login_tit">
                        <div class="logo">
                            <img src="<?php echo HTTP_UI; ?>images/logo.png" alt="logo"/>
                        </div>
                        <div class="login_tit_text">
                            <h2>商城后台管理系统</h2>
                            <em>website management system</em>
                        </div>
                    </div>
                    <div class="login_content">
                        <form name="form1" method="post" onsubmit="return checkLogin()">
                            <div class="left">
                                <p>请输入用户名及密码</p>
                                <label>用户名:<input id="username" name="userName" type="text" maxlength="20" placeholder="请输入用户名" data-rule="用户名:required;username" data-target="#usre"/></label>
                                <div class="usre" id="usre"></div>
                                <label>密&nbsp;  &nbsp;码:<input id="password" name="passWord" type="password" maxlength="20" placeholder="请输入密码"  data-rule="密码:required;password" data-target="#psd"/></label>
                                <div class="usre" id="psd"></div>
                                <div class="code">
                                    <input id="verifyCode" name="verifyCode" type="text" maxlength="5" placeholder="请输入验证码"/>
                                    <img id="verifyCodec" src='<?php echo DOMAIN_NAME_ADMIN.'/myverfy.php'; ?>' alt="验证码"/>                     
                                </div>
                            </div>
                            <div class="right">
                                <img src="<?php echo HTTP_UI; ?>images/user.png" alt="用户"/>
                                <input type="submit" name="ok" value="登录"/>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </body>
</html>
<script>
    function checkLogin() {
        var username = document.getElementById('username').value;
        var password = document.getElementById('password').value;
        var code = document.getElementById('verifyCode').value;
        $.post('index.php?C=Login&A=usreLogin', {
            userName: username,
            passWord: password,
            verifyCode: code
        }, function (data) {
            alert(data);
            if (data == 1) {
                location.href = '<?php ?>index.php?C=Login&A=index';
            } else {

                return false;
            }
        });
        return false;
    }
    /**
     * 验证码刷新
     */
    $("#verifyCodec").click(function () {
        $(this).attr('src', '<?php echo DOMAIN_NAME_ADMIN.'/myverfy.php'; ?>');
    });
</script>